﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="SingleLineManager.aspx.cs" Inherits="pages_Demo_rowEdit_SingleLineManager" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
    <title>多行添加及数据管理</title>
    <script language="javascript" type="text/javascript">
    // <!CDATA[
        function OpenChildWindow()
        {
             window.document.getElementById('btnHiddenForUpdate').click();
        }
    // ]]>
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <div>

    
    </div>

        <asp:Button ID="btnSubmit" runat="server" OnClick="btnSubmit_Click" Text="保存&提交"
            Width="164px" /><br />
        <br />
        <asp:GridView ID="GridView1" runat="server" BackColor="White" BorderColor="#CC9966"
            BorderStyle="None" BorderWidth="1px" CellPadding="4" AutoGenerateColumns="False" Width="440px">
            <Columns>
                <asp:TemplateField HeaderText="姓名">
                    <ItemTemplate>
                        <asp:Label ID="lblName" runat="server"><%# Eval("Sname")%></asp:Label>
                        <asp:HiddenField ID="HiddenField1" runat="server" Value='<%# Eval("pkid")%>' />
                    </ItemTemplate>
                </asp:TemplateField>
                
                <asp:TemplateField HeaderText="姓别">
                    <ItemTemplate>
                        <asp:Label ID="lblSex" runat="server"><%# Eval("Ssex")%></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                
                <asp:TemplateField HeaderText="年龄">
                    <ItemTemplate>
                        <asp:Label ID="lblID" runat="server"><%# Eval("Sage")%></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                
                <asp:TemplateField HeaderText="成绩">
                    <ItemTemplate>
                        <asp:Label ID="lblSource" runat="server"><%# Eval("Ssource")%></asp:Label>
                        <asp:TextBox ID="txtSource" runat="server"  Visible="False" Width="84px" Text='<%# Eval("Ssource")%>'></asp:TextBox>
                    </ItemTemplate>
                </asp:TemplateField>
                
                <asp:TemplateField HeaderText="操作">
                    <ItemTemplate>
                        <asp:LinkButton ID="lkbtonEdit" runat="server" CommandArgument='<%# Container.DataItemIndex %>' OnClick="lkbtonEdit_Click1">编辑</asp:LinkButton>
                        <asp:LinkButton ID="lkbtnUpdate" runat="server" Visible="False"  CommandArgument='<%# Container.DataItemIndex %>' OnClick="lkbtnUpdate_Click">更改</asp:LinkButton>&nbsp;&nbsp;
                        <asp:LinkButton ID="lkbtnDel" runat="server" CommandArgument='<%# Eval("pkid")%>' OnClick="lkbtnDel_Click">删除</asp:LinkButton>
                    </ItemTemplate>
                </asp:TemplateField>
            </Columns>
        </asp:GridView>
        <br />
        添加新数据
        <table style="width: 440px">
            <tr>
                <td style="width: 134px">
                    姓名</td>
                <td>
                    性别</td>
                <td>
                    年龄</td>
                <td>
                    成绩</td>
            </tr>
            <tr>
                <td style="width: 134px; height: 21px">
                    <asp:TextBox ID="txtName" runat="server" Width="97px"></asp:TextBox></td>
                <td style="height: 21px">
                    <asp:TextBox ID="txtSex" runat="server" Width="71px"></asp:TextBox></td>
                <td style="height: 21px">
                    <asp:TextBox ID="txtAge" runat="server" Width="52px"></asp:TextBox></td>
                <td style="height: 21px">
                    <asp:TextBox ID="txtSource" runat="server" Width="55px"></asp:TextBox></td>
            </tr>
        </table>

                <input id="btnAddRows" type="button" value="添加新数据" onclick="OpenChildWindow()" />
                <input id="btnHiddenForUpdate" runat="server" type="button" style="display:none" onserverclick="btnHiddenForUpdate_ServerClick" /><br />
        <br />
        &nbsp;
    </form>
</body>
</html>